import React from 'react';

function heightComponent(WrappedComponent) {
  return class extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        val: '高阶组件'
      }
    }

    onChange = (e) => {
      this.setState({val: e.target.value})
    }

    render() {
      return (
        <div>
          <h3>↓ This is HeightComponent</h3>
          <WrappedComponent val={this.state.val} {...this.props} />
        </div>
      );
    }
  }
}

export default heightComponent;